package top.tresman.cxxcommon.exception;

import lombok.Getter;
import lombok.Setter;
import top.tresman.cxxcommon.entity.constants.ErrorCodeEnum;

import java.io.Serial;

@Setter
@Getter
public class ApiException extends RuntimeException {
    @Serial
    private static final long serialVersionUID = 7016973589252162133L;

    private ErrorCodeEnum code;

    public ApiException() {
    }

    public ApiException(String message) {
        super(message);
        this.code = ErrorCodeEnum.BAD_ARGS;
    }

    public ApiException(ErrorCodeEnum code, String message) {
        super(message);
        this.code = code;
    }

}
